<?php if (defined('__ERROR__')): ?>
<style type="text/css" media="screen">
	div#grserror {
		margin: 10px;
		padding: 0;
		font-family: "Lucida Grande", "Lucida Sans", sans-serif;
	}
	
	div#grserror p {
		font-size: 85%;
	}
	
	div#grserror pre {
		font-family: Monaco, "Lucida Console", monospace;
	}
	
	div#grserror .heading {
		font-family: "Gill Sans", "Gill Sans MT", "Lucida Grande", "Lucida Sans", sans-serif;
		font-weight: normal;
		border-bottom: 1px solid #ddd;
	}
	
	div#grserror .backtrace {
		font-size: 85%;
		border-spacing: 0;
		border-collapse: collapse;
		background-color: #fefefe;
	}
	
	div#grserror .backtrace th, .backtrace td {
		padding: 5px;
		border: 1px solid #ccc;
	}
	
	div#grserror .backtrace th {
		background-color: #eee;
	}
</style>

<div id="grserror">
	<h2 class="heading">Game Record System Critical Error</h2>
	
	<p>An error was encountered during the lifetime of the application.</p>
	<p>This could be due to a variety of problems, such as a bug in the application.</p>
	<p><strong>However, normally it is caused by <em>misconfiguration</em>.</strong></p>
	
	<h2 class="heading">Exception Details</h2>
	<p>Error: <strong><?php echo get_class($e) ?></strong></p>
	<p>Message: <em><?php echo nl2br(htmlspecialchars($e->getMessage())) ?></em></p>
	<p>File: <?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></p>
	
	<?php if (count($e->getTrace())): ?>
	<!-- Exception Backtrace -->
	<table class="backtrace">
		<tr>
			<th>File</th>
			<th>Line</th>
			<th>Function/Method</th>
		</tr>
		<?php foreach ($e->getTrace() as $trace): ?>
		<tr>
			<td><?php echo $trace['file'] ?></td>
			<td><?php echo $trace['line'] ?></td>
			<td><?php echo isset($trace['class']) ? "$trace[class]::$trace[function]" : $trace['function'] ?>()</td>
		</tr>
		<?php endforeach ?>
	</table>
	
	<h2 class="heading">Exception Trace As String</h2>
	<pre><?php echo htmlspecialchars(preg_replace('/PDO->__construct\\((.+?)\\)/', 'PDO->__construct(*hidden*)', $e->getTraceAsString())) ?></pre>
	<?php endif ?>
</div>
<?php else: ?>
<h2>Error</h2>
<p>Message: <em><?php echo nl2br(htmlspecialchars($e->getMessage())) ?></em></p> 
<?php endif ?>